\hypertarget{group__pustowka__bumper}{
\section{BUMPER Library}
\label{group__pustowka__bumper}\index{BUMPER Library@{BUMPER Library}}
}


Interrupt Bumper library for checking the state of the bumper sensors in NXBOT.  
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
unsigned char \hyperlink{group__pustowka__bumper_gae9f4813b3a75478b52dc9790e70d313b}{bumpers\_\-read} (void)
\begin{DoxyCompactList}\small\item\em returns the last updated state of the bumpers. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pustowka__bumper_ga5d32322bb79bd9d9249ffca5fe412383}{bumpers\_\-init} (void)
\begin{DoxyCompactList}\small\item\em Hardware initialization for the bumpers module. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Interrupt Bumper library for checking the state of the bumper sensors in NXBOT. 
\begin{DoxyCode}
 #include <bumpers.h> 
\end{DoxyCode}
 This module is used to read the state of the four bumpers of NXBot robot. Each pin where a bumper is connected is capable of generating a hardware interrupt, specifically a PCINT (Pin Change Interrupt). That means, the module updates the state of the bumpers each time one of them has been pressed. Therefore, it is necessary to enable interrupts, for example via the {\itshape sei()\/} function. 

\subsection{Function Documentation}
\hypertarget{group__pustowka__bumper_ga5d32322bb79bd9d9249ffca5fe412383}{
\index{pustowka\_\-bumper@{pustowka\_\-bumper}!bumpers\_\-init@{bumpers\_\-init}}
\index{bumpers\_\-init@{bumpers\_\-init}!pustowka_bumper@{pustowka\_\-bumper}}
\subsubsection[{bumpers\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void bumpers\_\-init (void)}}
\label{group__pustowka__bumper_ga5d32322bb79bd9d9249ffca5fe412383}


Hardware initialization for the bumpers module. Configures each pin as inputs, and configures the PCINT interrupts. The pins are defined in the bumpers.c file. \hypertarget{group__pustowka__bumper_gae9f4813b3a75478b52dc9790e70d313b}{
\index{pustowka\_\-bumper@{pustowka\_\-bumper}!bumpers\_\-read@{bumpers\_\-read}}
\index{bumpers\_\-read@{bumpers\_\-read}!pustowka_bumper@{pustowka\_\-bumper}}
\subsubsection[{bumpers\_\-read}]{\setlength{\rightskip}{0pt plus 5cm}unsigned char bumpers\_\-read (void)}}
\label{group__pustowka__bumper_gae9f4813b3a75478b52dc9790e70d313b}


returns the last updated state of the bumpers. As the bumpers are binary \begin{DoxyReturn}{Returns}
A byte where the the first four bits represent the bumpers state:
\begin{DoxyItemize}
\item {\bfseries Bit0:} \par
 Front Left Bumper
\item {\bfseries Bit1:} \par
 Front Right Bumper
\item {\bfseries Bit2:} \par
 Back Left Bumper
\item {\bfseries Bit3:} \par
 Back Right Bumper 
\end{DoxyItemize}
\end{DoxyReturn}
